document.onkeydown = function(e) {
	if (!e)
		e = window.event;// 火狐中是 window.event
	if ((e.keyCode || e.which) == 13) {
		tologin($('#path').val());
	}
};

function tologin() {
	var value=$("#path").val();
	if (null == $('#account').val() || "" == $('#account').val()) {
		$("#message").text('账号不能为空！');
		return;
	}else if (null == $('#password').val() || "" == $('#password').val()) {
		$("#message").text('密码不能为空！');
		return;
	}else{
		$("#message").text('');
	}

	$.ajax({
		type : "POST",
		dataType : 'json',
		data : {
			account : $.trim($('#account').val()),
			password : $.trim($('#password').val())
		},
		//url : 'http://121.40.112.41:881/api/Account/Login/',
		url : 'http://localhost:56981/api/Account/Login/',
		success : function(data) {
			if (data.recode == '0000') {
				
				window.location.href = '/#remain';
						$.cookie('token', data.token);
						$.cookie('account', $.trim($('#account').val()));
			} else {
				alert(data.resmessage);
			}

		}
	});
}

function reset() {
	$('#account').val("");
	$('#password').val("");
//	$('#code').val("");
}

function tochange() {
	var value=$("#path").val();
	document.getElementById("vcodeimg").src = value + "/user/getValidateCode?r=" + Math.random();
}
